<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Mini-Web 角色管理</title>
		<%@ include file="/common/meta.jsp"%>
		<link href="${staticCtx}/style/yui.css" type="text/css" rel="stylesheet" />
		<link href="${staticCtx}/style/style.css" type="text/css" rel="stylesheet" />
		<link href="${staticCtx}/script/jquery/validate/jquery.validate.css" type="text/css" rel="stylesheet" />
		<script src="${staticCtx}/script/jquery/jquery.js" type="text/javascript"></script>
		<script src="${staticCtx}/script/jquery/validate/jquery.validate.js" type="text/javascript"></script>
		<script src="${staticCtx}/script/jquery/validate/messages_cn.js" type="text/javascript"></script>

		<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			$("#name").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate();
		});
	</script>
	</head>

	<body>
		<div id="doc3">
			<%@ include file="/common/header.jsp"%>
			<div id="bd">
				<div id="yui-main">
					<div class="yui-b">
						<h2>
							<s:if test="id == null">创建</s:if>
							<s:else>修改</s:else>
							角色
						</h2>
						<form action="${ctx}/account/roles" method="post">
							<input type="hidden" name="id" value="${role.id}" />
							<table class="noborder">
								<tr>
									<td>
										角色名:
									</td>
									<td>
										<input type="text" id="name" name="name" size="40" value="${role.name}" class="required" />
									</td>
								</tr>
								<tr>
									<td>
										授权:
									</td>
									<td>
										<c:forEach items="${grantedAuthList}" var="grantedAuth">
											<input type="checkbox" checked="checked" name="auth" value="${grantedAuth.id}" /> ${grantedAuth.name}
										</c:forEach>
										<c:forEach items="${availiableAuthList}" var="auth">
											<input type="checkbox" name="auth" value="${auth.id}" /> ${auth.name}
										</c:forEach>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<security:authorize ifAnyGranted="ROLE_修改角色">
											<input class="button" type="submit" value="提交" />&nbsp;
					</security:authorize>
										<input class="button" type="button" value="返回" onclick="history.back()" />
									</td>
								</tr>
							</table>
						</form>
					</div>
				</div>
			</div>
			<%@ include file="/common/footer.jsp"%>
		</div>
	</body>
</html>
